package com.slx.delete_node_in_a_linked_list;

class Solution {
    public void deleteNode(ListNode node) {

        if (node == null || node.next == null) {
            return;
        }

        ListNode prev = node;
        while (node.next != null) {
            node.val = node.next.val;
            prev = node;
            node = node.next;


        }

        prev.next = null;
    }
}